@extends("admin.layouts.main")
<style>
    .my-ver-align{vertical-align: -2px;}
    .btn-link{color:gray;}
    .my-daili{top:50%; right:0; z-index:1; margin-top:-13.6px;}
	.my-img {width: 59px; height: 38px; border-radius: 3px;}
	#code-img{width:130px;cursor:pointer;}
	#code-img:hover{transform:scale(1.8)}
  </style>
@section("content")
  <div class="container-fiuld p-3">
    <div class="card">
      <div class="card-body pt-1">
        <div class="row mt-1 mb-2">
          <div class="col-lg-12 pt-3 pb-3" style="background-color:#F2F2F2">
            <form class="form-inline position-relative">
			 <label for="created_at">时间：</label>			 
			 <input type="text" name="stime" class="layui-input test-laydate-item form-control mr-3" style="border-color:#ced4da" id="stime" value="{{$stime}}" placeholder="开始时间" lay-key="1">
			 <input type="text" name="etime" class="layui-input test-laydate-item form-control mr-3" style="border-color:#ced4da" id="etime" value="{{$etime}}" placeholder="结束时间" lay-key="2">
			 <select class="form-control" name="status" id="status">
                <option value="" >全部</option>
                <option value="3" @if($status == 3) selected @endif>审核中</option>
				<option value="1" @if($status == 1) selected @endif>审核成功</option>
				<option value="2" @if($status == 2) selected @endif>审核失败</option>
              </select>
			  <a class="btn btn-primary btn-sm ml-5 mr-3 search text-white">查询</a>
              <button type="reset" class="btn btn-secondary mr-3 btn-sm">重置</button>
            </form>
          </div>
        </div>
        <div class="row">
          <div class="col-lg-12 table-responsive">
            <table class="table layui-form">
              <thead class="thead-light">
                <tr class="text-dark">
                  <th>ID</th>
				  <th>公会ID/名称</th>
                  <th>姓名</th>
				  <th>手机号</th>
                  <th>支付宝账号</th>                  
                  <th class="text-center">支付宝收款码</th>
                  <th>状态</th>
				  <th>创建时间</th>
                  <th>审核时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
			  @foreach($alipay as $v)	  
                <tr>
                  <td>{{ $v->id }}</td>
                  <td>{{ $v->gid }}</td>
                  <td>{{ $v->name }}</td>
				  <td>{{ $v->mobile}}</td>
                  <td>{{ $v->alipay}}</td>
				  <td class="text-center"><img src="{{ $v->alipay_code}}" id="code-img"></td>
				  <!--td>
					  <a href="{{ $v->payment_img }}" target="_blank">
						<img src="{{ $v->payment_img }}" class="my-img">
					  </a>
				  </td>-->	  
                  <td>
					  @if($v->status == 1)
						<span class="layui-badge layui-bg-blue">审核成功</span>
					  @elseif($v->status == 2)
						<span class="layui-badge">审核失败</span>
					  @else
						<span class="layui-badge layui-bg-gray">审核中</span>
					  @endif
				  </td>	  
                  <td>{{ $v->created_at}}</td>
				  <td>{{ $v->updated_at ? $v->updated_at : '-'}}</td>
				  @if(in_array('draw.upalipayone', $menuRule) || in_array('draw.editalipay', $menuRule))
                  <td>
					@if(in_array('draw.upalipayone', $menuRule))					  
					<a href="{{ route('draw.upalipayone', ['id' => $v->id]) }}" class="btn btn-primary btn-sm">修改</a>
					@endif
					@if(in_array('draw.editalipay', $menuRule))
					<a data-url="{{ route('draw.editalipay', ['id' => $v->id]) }}" class="btn btn-danger btn-sm text-white edit">审核</a>
					@endif
                  </td>
				  @endif
                </tr>
			   @endforeach
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div style="text-align: right;">
		{{ $alipay->appends(['stime'=>$stime, 'etime' => $etime, 'status' => $status])->links('admin.layouts.paginate') }}
    </div>
    </div>
  </div>
@endsection

@section("js")
    <script type="text/javascript">		
        layui.use(['form', 'ori',"laydate"], function () {
            var form = layui.form,
                ori = layui.ori,
                dialog = layui.dialog,
                $ = layui.$
                laydate = layui.laydate;
			var	stime = '';
			var	etime = '';
			lay('.test-laydate-item').each(function(){
				laydate.render({
				  elem: this
				  ,trigger: 'click'
				});
			 });
            $('.search').click(function () {
                var stime = $("#stime").val();
				var etime = $("#etime").val();
				var status = $("#status").val();
                location.href = "{{ route('draw.alipay') }}" + '?stime=' + stime + ' &etime='+ etime + '&status='+status;
            });
            $('.edit').click(function () {
                dialog.pop({
                    'title': '审核',
                    'content': $(this).attr('data-url'),
                    'area': ['44%', '80%']
                });
            });
			//重置功能调用的方法
			ori.reset("[type=reset]");
        });
    </script>
@endsection
